import cv2
import numpy as np

img = cv2.imread('Resources/car20.jpg')
h, w = img.shape[0:2]
print(h,w)
gray = np.zeros((h, w), dtype=img.dtype)

for i in range(h):
    for j in range(w):
        gray[i, j] = (0.3*int(img[i, j, 0]) + 0.59*int(img[i, j, 1]) + 0.11*int(img[i, j, 2]))

cv2.imshow('Gray',gray)
cv2.imshow('Result',img)
cv2.waitKey(0)